package com.iotechn.unimall.app.api.plantgoods;

import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;

@HttpOpenApi(group = "plantgoods", description = "商品")
public interface PlantGoodsService {

    @HttpMethod(description = "根据人获取商品信息")
    public Object selectGoodsByUser(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "userId") Long userId) throws Exception;

    @HttpMethod(description = "商品添加")
    public Object insertGood(
            @HttpParam(name = "title", type = HttpParamType.COMMON, description = "商品名称") String title,
            @HttpParam(name = "price", type = HttpParamType.COMMON, description = "价格") Double price,
            @HttpParam(name = "img", type = HttpParamType.COMMON, description = "图片") String img,
            @HttpParam(name = "stock", type = HttpParamType.COMMON, description = "库存数") Double stock,
            @HttpParam(name = "categoryId", type = HttpParamType.COMMON, description = "分类") Long categoryId,
            @HttpParam(name = "yield", type = HttpParamType.COMMON, description = "日产量") Double yield,
            @HttpParam(name = "unit", type = HttpParamType.COMMON, description = "单位") String unit,
            @HttpParam(name = "lgla", type = HttpParamType.COMMON, description = "坐标") String lgla,
            @HttpParam(name = "address", type = HttpParamType.COMMON, description = "详细地址") String address,
            @HttpParam(name = "street", type = HttpParamType.COMMON, description = "街道") String street,
            @HttpParam(name = "areaId", type = HttpParamType.COMMON, description = "区域id") Long areaId,
            @HttpParam(name = "contactName", type = HttpParamType.COMMON, description = "联系人名称") String contactName,
            @HttpParam(name = "contactPhone", type = HttpParamType.COMMON, description = "联系电话") String contactPhone,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "userId") Long userId
    ) throws Exception;


    @HttpMethod(description = "记录商品")
    public Object saveCurrPriceAndStock(
            @NotNull @HttpParam(name = "goodId", type = HttpParamType.COMMON, description = "商品id") Long goodId,
            @HttpParam(name = "yield", type = HttpParamType.COMMON, description = "每日产量") Double yield,
            @HttpParam(name = "title", type = HttpParamType.COMMON, description = "品名") String title,
            @HttpParam(name = "contactName", type = HttpParamType.COMMON, description = "联系人名称") String contactName,
            @HttpParam(name = "contactPhone", type = HttpParamType.COMMON, description = "联系电话") String contactPhone,
            @NotNull @HttpParam(name = "unit", type = HttpParamType.COMMON, description = "每日产量") String unit,
            @HttpParam(name = "currPrice", type = HttpParamType.COMMON, description = "单价") Double currPrice,
            @NotNull @HttpParam(name = "currStock", type = HttpParamType.COMMON, description = "最新库存") Double currStock,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "userId") Long userId
    ) throws Exception;

    @HttpMethod(description = "首页今日商品接口")
    public Object todayGoods() throws Exception;


    @HttpMethod(description = "查看详情")
    public Object getGoodsById(@NotNull @HttpParam(name = "goodId", type = HttpParamType.COMMON, description = "商品id") Long goodId
    ) throws Exception;

    @HttpMethod(description = "今日商品接口")
    public Object getTodayGoods(
            @HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页长度", valueDef = "20") Integer limit,
            @HttpParam(name = "areaId", type = HttpParamType.COMMON, description = "区域id") Long areaId,
            @HttpParam(name = "categoryId", type = HttpParamType.COMMON, description = "所属分类") Long categoryId,
            @HttpParam(name = "goodName", type = HttpParamType.COMMON, description = "商品名") String goodName,
            @HttpParam(name = "sPrice", type = HttpParamType.COMMON, description = "价格开始") Double sPrice,
            @HttpParam(name = "ePrice", type = HttpParamType.COMMON, description = "价格结束") Double ePrice

    ) throws Exception;

    @HttpMethod(description = "用户自己删除功能")
    public Object deleteByGoodId(
            @NotNull @HttpParam(name = "goodId", type = HttpParamType.COMMON, description = "商品id") Long goodId,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "userId") Long userId
    ) throws Exception;


    @HttpMethod(description = "商品列表")
    public Object plantGoods(@HttpParam(name = "pageNo", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
                             @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页长度", valueDef = "10") Integer limit,
                             @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "userId") Long userId) throws Exception;


}
